#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(daemon-server, 1.0, michael.s.china@gmail.com)
AC_CONFIG_SRCDIR([main.cpp])
#AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE(daemon-server, 1.0)

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC

# Checks for libraries.
AC_PROG_RANLIB

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stddef.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_CHECK_TYPES([ptrdiff_t])

AC_ARG_ENABLE(debug,
	[ --enable-debug ],
	[ if test "${enableval}" = "yes"; then
		debug=true
	  else
		debug=false
	  fi],
	[ debug=false ])
AM_CONDITIONAL(DEBUG_MAIN, test "$debug" = "true")

AC_ARG_ENABLE(debugthread,
	[ --enable-debugthread ],
	[ if test "${enableval}" = "yes"; then
		debugthread=true
	  else
		debugthread=false
	  fi],
	[ debugthread=false ])
AM_CONDITIONAL(DEBUG_THREAD, test "$debugthread" = "true")

AC_ARG_ENABLE(debugxml,
	[ --enable-debugxml ],
	[ if test "${enableval}" = "yes"; then
		debugxml=true
	  else
		debugxml=false
	  fi],
	[ debugxml=false ])
AM_CONDITIONAL(DEBUG_XML, test "$debugxml" = "true")

# Checks for library functions.
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([bzero memmove select socket strchr])

#AC_CONFIG_FILES([Makefile])
AC_OUTPUT(Makefile
			client/Makefile
			src/communication/Makefile
			src/threadpool/Makefile
			src/tinyxml/Makefile)
